angular.module('demo', ['ui.router', 'oc.lazyLoad'])
    .config(($stateProvider, $urlRouterProvider) => {

        $stateProvider.state('home', {
            url        : '/home',
            templateUrl: 'home/home.html'
        }).state('store', {
            url        : '/store',
            templateUrl: 'store/store.html',
            controller : 'StoreCtrl as store',
            resolve    : {
                store($ocLazyLoad) {
                    return $ocLazyLoad.load({
                        name : 'store',
                        files: ['store/store.js']
                    });
                }
            }
        }).state('sys', {
            url        : '/sys',
            templateUrl: 'sys/sys.html',
            resolve    : {
                store($ocLazyLoad) {
                    return $ocLazyLoad.load({
                        name : 'sys',
                        files: ['sys/sys.js']
                    });
                }
            }
        });

        $urlRouterProvider.otherwise('/home');
    })
    .controller('AppCtrl', function () {
        var ctrl = this;
    });